package pages;

import org.openqa.selenium.By;
import selenium.WebDriverWrapper;

/**
 * Created by sergey on 04.07.2014.
 */
public abstract class BasicPage {
    protected static final By AMOUNT_OF_PRODUCTS_IN_CART_LOCATOR = By.xpath("//div[@class='summary']/p[@class='amount']");
    protected String URL = "http://www.freddydiamonds.com/";
    protected WebDriverWrapper driver;

    public BasicPage(WebDriverWrapper driver){
        this.driver = driver;

    }
    public boolean checkAmountOfProductsInCart(Integer expectedAmount)
    {
        return driver.findElement(AMOUNT_OF_PRODUCTS_IN_CART_LOCATOR).getText().contains(expectedAmount.toString());
    }
    public void Open(){
        driver.get(URL);
    }
    public boolean isOpened(){
        return driver.getCurrentUrl().equals(URL);
    };

}
